package com.blacktry.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.blacktry.entity.model.ApiResult;
import com.blacktry.entity.model.Admin;
import com.baomidou.mybatisplus.extension.service.IService;
import com.blacktry.entity.model.ExamManage;
import com.blacktry.entity.model.Role;
import com.blacktry.entity.model.Vo.UserVo;
import com.blacktry.entity.model.request.AdminRequest;
import com.blacktry.entity.model.request.LoginRequest;
import com.blacktry.entity.model.request.PasswordRequest;
import com.blacktry.entity.model.request.UserRequest;
import com.blacktry.entity.model.vueVO.Option;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author blackTry
 * @since 2021-06-23
 */
public interface AdminService extends IService<Admin> {

    Integer insert(Admin admin);

    Page<Admin> selectAdminPage(AdminRequest adminRequest, Page<Admin> adminPage);

    Integer deleteBatchId(String[] ids);

    Admin selectById(Integer id);

    Integer insertOrUpdate (Admin admin);

    Admin selectByUsername(String username);

    /**
     * 登录之后返回token
     * @param loginRequest
     * @param request
     * @return
     */
    ApiResult<Map<String,String>> login(LoginRequest loginRequest, HttpServletRequest request);

    /**
     * 根据用户名获取用户
     * @param username
     * @return
     */
    Admin getAdminByUserName(String username);

    /**
     * 根据用户id查询角色列表
     * @param id
     * @return
     */
    List<Role> getRoles(Integer id);

    Boolean isRightPassword(Integer id,String password);

    Page<Admin> selectPage(UserRequest userRequest, Page<Admin> adminPage);

    Integer updateEnabled(Integer id, Integer enabled);

    Page<UserVo> selectRole(String role,Page<UserVo> page);

    String updateFace(MultipartFile file,String username);

    Boolean updatePassword(PasswordRequest passwordRequest);

    String[] selectAllAffiliation();

    List<Option> selectAllTeacher();
}
